package com.banciyuan.wallpaper.setting;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by squall on 2016/8/1.
 */
public class SettingConfig {

    public static final String SETTING = "setting";
    public static final String SEX = "sex";
    public static final String WIFI = "wifi";
    public static final String CHANGE = "change";
    public static final String BOY = "boy";
    public static final String GIRL = "girl";
    public static final String CHANGE_TIEM="change_time";


    public static void WriteSettingBoolean(Context mContext, String name, boolean setting) {
        SharedPreferences sharedPreferences = mContext.getSharedPreferences(SETTING, Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.putBoolean(name, setting);
        editor.commit();
    }

    public static void WriteSettingString(Context mContext, String name, String setting) {
        SharedPreferences sharedPreferences = mContext.getSharedPreferences(SETTING, Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.putString(name, setting);
        editor.commit();
    }

    public static boolean ReadSettingBoolean(Context mContext, String name) {
        SharedPreferences sharedPreferences = mContext.getSharedPreferences(SETTING, Context.MODE_PRIVATE);
        return sharedPreferences.getBoolean(name, true);
    }

    public static String ReadSettingString(Context mContext, String name) {
        SharedPreferences sharedPreferences = mContext.getSharedPreferences(SETTING, Context.MODE_PRIVATE);
        return sharedPreferences.getString(name, "");
    }

    public static boolean isSettingExit(Context mContext, String name) {
        SharedPreferences sharedPreferences = mContext.getSharedPreferences(SETTING, Context.MODE_PRIVATE);
        return sharedPreferences.contains(name);
    }
}
